package com.ruoyi.wgjlcData.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.wgjlcData.domain.plat.DataWgjlcZhdjlgps;
import com.ruoyi.wgjlcData.service.IDataWgjlcZhdjlgpsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 无轨胶轮车制动距离测试项Controller
 * 
 * @author ruoyi
 * @date 2024-02-27
 */
@RestController
@RequestMapping("/wgjlc/zhdjlgps")
public class DataWgjlcZhdjlgpsController extends BaseController
{
    @Autowired
    private IDataWgjlcZhdjlgpsService dataWgjlcZhdjlgpsService;

    /**
     * 查询无轨胶轮车制动距离测试项列表
     */
    @PreAuthorize("@ss.hasPermi('wgjlc:zhdjlgps:list')")
    @GetMapping("/list")
    public TableDataInfo list(DataWgjlcZhdjlgps dataWgjlcZhdjlgps)
    {
        startPage();
        List<DataWgjlcZhdjlgps> list = dataWgjlcZhdjlgpsService.selectDataWgjlcZhdjlgpsList(dataWgjlcZhdjlgps);
        return getDataTable(list);
    }

    /**
     * 导出无轨胶轮车制动距离测试项列表
     */
    @PreAuthorize("@ss.hasPermi('wgjlc:zhdjlgps:export')")
    @Log(title = "无轨胶轮车制动距离测试项", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DataWgjlcZhdjlgps dataWgjlcZhdjlgps)
    {
        List<DataWgjlcZhdjlgps> list = dataWgjlcZhdjlgpsService.selectDataWgjlcZhdjlgpsList(dataWgjlcZhdjlgps);
        ExcelUtil<DataWgjlcZhdjlgps> util = new ExcelUtil<DataWgjlcZhdjlgps>(DataWgjlcZhdjlgps.class);
        util.exportExcel(response, list, "无轨胶轮车制动距离测试项数据");
    }

    /**
     * 获取无轨胶轮车制动距离测试项详细信息
     */
    @PreAuthorize("@ss.hasPermi('wgjlc:zhdjlgps:query')")
    @GetMapping(value = "/{zhdjlgpsId}")
    public AjaxResult getInfo(@PathVariable("zhdjlgpsId") Long zhdjlgpsId)
    {
        return success(dataWgjlcZhdjlgpsService.selectDataWgjlcZhdjlgpsByZhdjlgpsId(zhdjlgpsId));
    }

    /**
     * 新增无轨胶轮车制动距离测试项
     */
    @PreAuthorize("@ss.hasPermi('wgjlc:zhdjlgps:add')")
    @Log(title = "无轨胶轮车制动距离测试项", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DataWgjlcZhdjlgps dataWgjlcZhdjlgps)
    {
        return toAjax(dataWgjlcZhdjlgpsService.insertDataWgjlcZhdjlgps(dataWgjlcZhdjlgps));
    }

    /**
     * 修改无轨胶轮车制动距离测试项
     */
    @PreAuthorize("@ss.hasPermi('wgjlc:zhdjlgps:edit')")
    @Log(title = "无轨胶轮车制动距离测试项", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DataWgjlcZhdjlgps dataWgjlcZhdjlgps)
    {
        return toAjax(dataWgjlcZhdjlgpsService.updateDataWgjlcZhdjlgps(dataWgjlcZhdjlgps));
    }

    /**
     * 删除无轨胶轮车制动距离测试项
     */
    @PreAuthorize("@ss.hasPermi('wgjlc:zhdjlgps:remove')")
    @Log(title = "无轨胶轮车制动距离测试项", businessType = BusinessType.DELETE)
	@DeleteMapping("/{zhdjlgpsIds}")
    public AjaxResult remove(@PathVariable Long[] zhdjlgpsIds)
    {
        return toAjax(dataWgjlcZhdjlgpsService.deleteDataWgjlcZhdjlgpsByZhdjlgpsIds(zhdjlgpsIds));
    }
}
